//
//  Tools.m
//  find
//
//  Created by 吕超 on 16/12/27.
//  Copyright © 2016年 ywydz. All rights reserved.
//

#import "Tools.h"

@implementation Tools


//强制旋转屏幕
+ (void)orientationToPortrait:(UIInterfaceOrientation)orientation{
    
    SEL selector = NSSelectorFromString(@"setOrientation:");
    
    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
    
    [invocation setSelector:selector];
    
    [invocation setTarget:[UIDevice currentDevice]];
    
    int val = orientation;
    
    [invocation setArgument:&val atIndex:2];//前两个参数已被target和selector占用
    
    [invocation invoke];
}


@end
